unit uSettings;

interface

uses cuSimpleINI;

{
Usage:

  SettingsINI := TSettingsINI.Create;
  SettingsINI.SetSettings(GetEXEPath+'\settings.ini');//may need to "ucFuncs.pas" into uses clause.
}

type
  TSettingsINI = class (TSimpleINI)
  private
  public
//  [DEBUG]
    sDebug            : string;
    sDataPath         : string;
    sImagePath        : string;

//  [UNIVERSE]
    iMinPlanets       : integer;
    iMaxPlanets       : integer;
    iMaxOrbits        : integer;
    iMaxSolarSystems  : integer;
    iBlackSpace       : integer;
    iMinStarLanes     : integer;
    iMaxStarLanes     : integer;

//  [AI]
    iAIPlayers        : integer;
    iAISkill          : integer;
    bEmpireDead       : boolean;

//  [TEXTURES]
    sGalaxyStyle      : string;
    iTextureWidth     : integer;
    iTextureHeight    : integer;
    iWhiteChance      : integer;
    iRedChance        : integer;
    iBlackChance      : integer;

//  [SCREEN OPTIONS]
    iResWidth         : integer;
    iResHeight        : integer;
    bFullscreen       : boolean;
    iBaseFPS          : integer;
    rZoom             : real;
    rZoomStep         : real;
    rZoomMin          : real;
    rZoomMax          : real;

    procedure loadSettings(nSettingsFile:string);
    procedure saveSettings(nSettingsFile:string);
  end;

var
  SettingsINI   : TSettingsINI;

implementation

procedure TSettingsINI.loadSettings(nSettingsFile:string);
begin
  if (Load( nSettingsFile )) then
  begin
    sDebug            := sFind('sDebug');
    sDataPath         := sFind('sDataPath');
    sImagePath        := sFind('sImagePath');

    iMinPlanets       := iFind('iMinPlanets');
    iMaxPlanets       := iFind('iMaxPlanets');
    iMaxOrbits        := iFind('iMaxOrbits');
    iMaxSolarSystems  := iFind('iMaxSolarSystems');
    iBlackSpace       := iFind('iBlackSpace');
    iMinStarLanes     := iFind('iMinStarLanes');
    iMaxStarLanes     := iFind('iMaxStarLanes');

    iAIPlayers        := iFind('iAIPlayers');
    iAISkill          := iFind('iAISkill');
    bEmpireDead       := bFind('bEmpireDead');

    rZoom             := rFind('rZoom');
    rZoomStep         := rFind('rZoomStep');
    rZoomMin          := rFind('rZoomMin');
    rZoomMax          := rFind('rZoomMax');

    sGalaxyStyle      := sFind('sGalaxyType');
    iTextureWidth     := iFind('iTextureWidth');
    iTextureHeight    := iFind('iTextureHeight');
    iWhiteChance      := iFind('iWhiteChance');
    iRedChance        := iFind('iRedChance');
    iBlackChance      := iFind('iBlackChance');

    iResWidth         := iFind('iScreenWidth'); // These are now in the settings.ini file and changing those will affect this.
    iResHeight        := iFind('iScreenHeight');
    bFullscreen       := bFind('bFullscreen');
    iBaseFPS          := iFind('iBaseFPS');
  end;
end;

procedure TSettingsINI.saveSettings(nSettingsFile:string);
begin

end;

end.
